﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FeatureModelCore.FMShapes
{
    public class FMAngle
    {
        #region Properties
        public FMPoint PointA { get { return _pointA; } set { _pointA = value; } }
        public FMPoint PointB { get { return _pointB; } set { _pointB = value; } }
        public double AngleRadian { get { return _angleRadian; } set { _angleRadian = value; } }
        #endregion
        #region Fields
        private FMPoint _pointA;
        private FMPoint _pointB;
        private double _angleRadian;
        #endregion
        public FMAngle()
        {
            _pointA = default(FMPoint);
            _pointB = default(FMPoint);
            _angleRadian = default(double);
        }
        public override string ToString()
        {
            return string.Format("Angle: From {0} to {1} is {2}"
                , _pointA, _pointB, _angleRadian);
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
        public override bool Equals(object obj)
        {
            if (this._pointA == null || this._pointB == null)
            {
                return false;
            }
            FMAngle tmpAngle = obj as FMAngle;
            if (tmpAngle == null)
            {
                return false;
            }
            return this._angleRadian == tmpAngle._angleRadian
                && this._pointA.Equals(tmpAngle._pointA)
                && this._pointB.Equals(tmpAngle._pointB);
        }
    }
}
